package com.learn.jdk;

import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.logging.Filter;

/**
 * Copyright: Copyright (c) 2019 Asiainfo
 *
 * @ClassName: com.learn.jdk.PredicateTest2
 * @Description: 该类的功能描述
 * @version: v1.0.0
 * @author: lipan
 * @date: 2019/11/7 19:46
 * <p>
 * Modification History:
 * Date         Author          Version            Description
 * ------------------------------------------------------------
 * 2019/11/7      lipan          v1.0.0               修改原因
 */

public class PredicateTest2 {


    public static void main(String[] args) {
        List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
        filter(integers,i->i>5,i->i%2==0);
        System.out.println(testIsEqual("test").test("aaaa"));//aaaa is object，test is  targetRef
    }


    public static   void  filter(List<Integer> list, Predicate<Integer> p1,Predicate<Integer> p2){
        for (Integer i : list) {
            if(p1.and(p2).negate().test(i)){
                System.out.println(i);
            }
        }

    }


    public static   Predicate  testIsEqual(Object obj){

          return Predicate.isEqual(obj);
    }
}
